<template>
	<view>
		<!-- 成功捞到丸子 -->
		<view class="form" v-show="!!visible">
			<view class="title">
				<text>恭喜您,成功捞到优惠券啦!</text>
			</view>
			<view class="content">
				<image class="coupon" src="../../static/game/coupon.jpg"></image>
				<uni-easyinput type="text" v-model="content" placeholder="请输入需要绑定的手机号~"></uni-easyinput>
			</view>
			<view class="operations">
				<view class="btn blue" @click="reStart">
					<text>再玩一次</text>
				</view>
				<view class="btn submit" @click="submit">
					<text>提交</text>
				</view>
			</view>
		</view>
		<!-- 遮罩层 -->
		<view class="shadow" v-show="!!visible"></view>
	</view>
</template>

<script>
	export default {
		props: {
			visible: false
		},
		data() {
			return {
				content: ''
			}
		},
		methods: {
			reStart() {
				this.$emit('reStart')
			},
			submit() {
				this.$emit('closeForm')
				uni.showToast({
					title: '提交成功!',
					duration: 2000,
					icon: 'none'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	// 表单
	.form {
		position: fixed;
		left: 50%;
		top: 50%;
		width: 500px;
		height: 300px;
		margin: -150px 0 0 -250px;
		z-index: 1000;
		background: #FFF;
		border-radius: 16px;
		box-shadow: 0px 0px 15px #d1d1d1;
		padding: 15px;
		text-align: center;
	}

	// 遮罩层
	.shadow {
		position: fixed;
		left: 0;
		top: 0;
		opacity: .2;
		width: 100%;
		height: 100%;
		background: #000;
		z-index: 998;
		// pointer-events: none; //不能操作
	}

	// 标题
	.title {
		font-size: 16px;
		font-weight: 700;
		margin-bottom: 20px;
	}

	// 优惠券&输入框
	.content {
		margin-bottom: 20px;
		
		.coupon{
			width: 100%;
			height: 150px;
			margin-bottom: 10px;
		}
	}

	// 按钮
	.operations {
		display: flex;
		justify-content: space-around;

		.btn {
			height: 30px;
			line-height: 30px;
			border-radius: 6px;
			padding: 2px 8px;
			color: #FFFFFF;
		}

		.blue {
			background: skyblue;
		}

		.submit {
			background: #FF7970;
		}
	}
</style>
